﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimTank
{
    public class Attack
    {
        public string name;
        public int damage;
        public bool isAvoidable = true;
        public bool useSpellHit = false;
        public SchoolEnum spellschool;
        public List<Debuff> CausesDebuffs;
        public double critmodifier = 2; //2 unless there's some other reason (talents)
        public int spellID;

        public Attack()
        {
            CausesDebuffs = new List<Debuff>();
        }

        public Attack(string name, int damage, SchoolEnum school)
        {
            this.name = name;
            this.damage = damage;
            this.spellschool = school;
            CausesDebuffs = new List<Debuff>();
        }

        public static int operator +(int prevdmg, Attack Attacker)
        {
            return prevdmg + Attacker.damage;
        }

        public double threatmod;
        public double inatethreat;
        public int threat
        {
            get
            {
                return (int)((damage + inatethreat) * threatmod); //this should give the threat from this attack
            }
        }

        public static Attack operator *(Attack Attack, double scalar)
        {
            Attack ret = Attack;
            ret.damage = (int)(scalar * Attack.damage);
            if (Attack.CausesDebuffs.Count != 0)
                for (int i = 0; i < Attack.CausesDebuffs.Count; i++)
                    ret.CausesDebuffs[i].damage = (int)(Attack.CausesDebuffs[i].damage * scalar);
            return ret;
        }
    }
}
